package org.dwell.dubbox.consumer;

import org.dwell.dubbox.api.DemoSayHelloService;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Jange on 2016/3/23.
 */
public class DemoAction {

    private DemoSayHelloService demoSayHelloService;

    public void setDemoSayHelloService(DemoSayHelloService demoSayHelloService) {
        this.demoSayHelloService = demoSayHelloService;
    }

    public void start() throws Exception {
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            try {
                String hello = demoSayHelloService.sayHello("world" + i);
                System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + hello);
            } catch (Exception e) {
                e.printStackTrace();
            }

            Thread.sleep(2000);
        }
    }

}
